1 /* 2 * Copyright (c) 2013-2014 - Mauro Carvalho Chehab <m.chehab@samsung.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation version 2.1 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 17 * 18 * Described on ARIB STD-B10 as Terrestrial delivery system descriptor 19 */ 20 21 /** 22 * @file desc_isdbt_delivery.h 23 * @ingroup descriptors 24 * @brief Provides the descriptors for the ISDB-T terrestrial delivery system 25 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 26 * @author Mauro Carvalho Chehab 27 * 28 * @par Relevant specs 29 * The descriptor described herein is defined at: 30 * - ARIB STD-B10 31 * 32 * @par Bug Report 33 * Please submit bug reports and patches to linux-media@vger.kernel.org 34 */ 35 36 module libdvbv5_d.desc_isdbt_delivery; 37 38 import libdvbv5_d.descriptors: dvb_desc; 39 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms; 40 41 extern (C): 42 43 /** 44 * @struct isdbt_desc_terrestrial_delivery_system 45 * @ingroup descriptors 46 * @brief Struct containing the ISDB-T terrestrial delivery system 47 * 48 * @param type descriptor tag 49 * @param length descriptor length 50 * @param next pointer to struct dvb_desc 51 * @param area_code area code. The area code definition varies from 52 * Country to Country. 53 * @param guard_interval guard interval 54 * @param transmission_mode transmission mode 55 * @param frequency vector with center frequencies 56 * @param num_freqs number of frequencies at the 57 * isdbt_desc_terrestrial_delivery_system::frequency vector 58 */ 59 struct isdbt_desc_terrestrial_delivery_system 60 { 61 align (1): 62 63 ubyte type; 64 ubyte length; 65 dvb_desc* next; 66 67 uint* frequency; 68 uint num_freqs; 69 70 union 71 { 72 align (1): 73 74 ushort bitfield; 75 76 struct 77 { 78 import std.bitmanip : bitfields; 79 align (1): 80 81 mixin(bitfields!( 82 ushort, "transmission_mode", 2, 83 ushort, "guard_interval", 2, 84 ushort, "area_code", 12)); 85 } 86 } 87 } 88 89 // struct dvb_v5_fe_parms; 90 91 /** 92 * @brief Initializes and parses the ISDB-T terrestrial delivery system 93 * descriptor 94 * @ingroup descriptors 95 * 96 * @param parms struct dvb_v5_fe_parms pointer to the opened device 97 * @param buf buffer containing the descriptor's raw data 98 * @param desc pointer to struct dvb_desc to be allocated and filled 99 * 100 * This function allocates a the descriptor and fills the fields inside 101 * the struct. It also makes sure that all fields will follow the CPU 102 * endianness. Due to that, the content of the buffer may change. 103 * 104 * @return On success, it returns the size of the allocated struct. 105 * A negative value indicates an error. 106 */ 107 int isdbt_desc_delivery_init ( 108 dvb_v5_fe_parms* parms, 109 const(ubyte)* buf, 110 dvb_desc* desc); 111 112 /** 113 * @brief Prints the content of the ISDB-T terrestrial delivery system 114 * descriptor 115 * @ingroup descriptors 116 * 117 * @param parms struct dvb_v5_fe_parms pointer to the opened device 118 * @param desc pointer to struct dvb_desc 119 */ 120 void isdbt_desc_delivery_print (dvb_v5_fe_parms* parms, const(dvb_desc)* desc); 121 122 /** 123 * @brief Frees all data allocated by the ISDB-T terrestrial delivery system 124 * descriptor 125 * @ingroup descriptors 126 * 127 * @param desc pointer to struct dvb_desc to be freed 128 */ 129 void isdbt_desc_delivery_free (dvb_desc* desc); 130 131 /** 132 * Converts an ISDB-T Interval code into a string 133 */ 134 extern __gshared const(uint)[] isdbt_interval; 135 136 /** 137 * Converts an ISDB-T mode into a string 138 */ 139 extern __gshared const(uint)[] isdbt_mode;